﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Web.Mvc.Html;
//using System.Web.Mvc;
//using System.IO;

//namespace Mindfor.Web.Mvc
//{
//    /// <summary>
//    /// Class-helper to provide creating link buttons in views in "using() { }" manner.
//    /// </summary>
//    public class MvcLinkButton : IDisposable
//    {
//        // This variable can be set only in special constructor
//        private readonly HtmlHelper m_helper = null;

//        private bool m_isDisposed = false;

//        private MvcLinkButton()
//        {
//        }

//        /// <summary>
//        /// Generates link button opening tag.
//        /// </summary>
//        /// <param name="helper">Html helper.</param>
//        /// <param name="text">Text on the button.</param>
//        /// <param name="iconName">Icon name (png should be in the /Content/Icons).</param>
//        /// <param name="url">Url for the link.</param>
//        /// <param name="helpTitle">Help title for the link button.</param> 
//        /// <param name="additionalHtmlAttributes">Attributes for link ('a' html tag). "_" is replaced with "-"!</param>
//        public MvcLinkButton(HtmlHelper helper, string text, string iconName, string url,
//                            object additionalHtmlAttributes = null, string helpTitle = null)
//        {
//            if (helper == null)
//            {
//                throw new ArgumentNullException("helper");
//            }

//            m_helper = helper;

//            // Here is the very logic
//            m_helper.LinkButtonBeginInner(text, iconName, url, additionalHtmlAttributes, helpTitle);
//        }

//        /// <summary>
//        /// Generates link button opening tag.
//        /// </summary>
//        /// <param name="helper">Html helper.</param>
//        /// <param name="text">Text on the button.</param>
//        /// <param name="iconName">Icon name (png should be in the /Content/Icons).</param>
//        /// <param name="url">Url for the link.</param>
//        /// <param name="helpTitle">Help title for the link button.</param>
//        /// <param name="additionalHtmlAttributes">Attributes for link ('a' html tag). "_" is replaced with "-"!</param>
//        public MvcLinkButton(HtmlHelper helper, string text, string iconName, string url,
//                            IDictionary<string, object> additionalHtmlAttributes, string helpTitle = null)
//        {
//            if (helper == null)
//            {
//                throw new ArgumentNullException("helper");
//            }

//            m_helper = helper;

//            // Here is the very logic
//            m_helper.LinkButtonBeginInner(text, iconName, url, additionalHtmlAttributes, helpTitle);
//        }

//        /// <summary>
//        /// Renders finishing tags.
//        /// </summary>
//        public void LinkButtonEnd()
//        {
//            this.Dispose(true);
//        }

//        #region IDisposable Members

//        public void Dispose()
//        {
//            this.Dispose(true);
//            GC.SuppressFinalize(this);
//        }

//        /// <summary>
//        /// Sets disposed to true and renders finishing tags.
//        /// </summary>
//        protected virtual void Dispose(bool disposing)
//        {
//            if (!m_isDisposed && disposing)
//            {
//                m_isDisposed = true;
//                m_helper.LinkButtonEndInner();
//            }
//        }

//        #endregion
//    }
//}
